#include <stdafx.h>
#include <iostream>
#include <string>

using namespace std;


void makerpn2() {

	
	char ext[] = { 63, 63, 63, 61, 43, 45, 42, 47, 65, 66,
		           67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
				   77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
				   87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
				   103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
				   113, 114, 115, 116, 117, 118, 119, 120, 121, 122},
				   inform[241], rpn[241], stak[80];
	
	char * r;
	char * p;
	char * t;
	char n;
	char s;

	static char pr[] = {0,0,1,2,3,3,4,4};
	s = *p;

	cout << "\nRPN form:\n\n";

	inform[0] = (char)'34';
	inform[1] = (char)'3';
	inform[2] = (char)'35';
	inform[3] = (char)'\0';

	t = stak - 1;
	r = rpn;

	p = &inform[0];

	for(p = inform; *p != '\0'; p++) {

		  s = *p;

		  if(s > 7){

			   *r++ = s;   
			   continue;
		  }
		  else{

			  if(s == 1) {

				  *++t = s;   
				  continue;
			  }
			  else{

				  while(1){

					  if(t < stak ){

						  *++t = s;
						  break;
					  }
					  else{
						     n = *t--;
							 if(pr[s] <= pr[n]) {

								 *r++ = n;
								 continue;
							 }
							 else{
								 if(3 < n + s) {

									 *++t = n;
									 *++t = s;
								 }
								 break;
								 }
					      }
				  }
				  continue;
			    }
	      }
	  
	  }


	while(stak <= t) {

		*r++ = *t--;
		continue;

	   }

	*r = '\0';

	for(r = rpn; *r != '\0'; r++) {

		cout << ext[(int)* r];

	}

	cout << "\n\n";

}
    


